package logique.programme;

import logique.solution.Solution;
import logique.solution.Variable;

public class Terme {

	private double coeff;

	private Variable variable;
	
	public Terme (double coeff, Variable variable) {
		this.coeff = coeff;
		this.variable = variable;
	}

	public double getCoeff() {
		return coeff;
	}
	public void setCoeff (double d) {
		coeff = d;
	}
	public Variable getVariable() {
		return variable;
	}
	
	public String toString () {
		return "(" + coeff + " * " + variable.toStringCourt() + ")";
	}
	public void afficher () {
		System.out.print("(" + coeff + " * " + variable.toStringCourt() + ")");
	}
	public Terme getCopy(Variable v) {
		return new Terme(getCoeff(), v);
	}
	
	public double evaluer (Solution s) {
		return s.getAffectation(variable) * coeff;
	}
	
}
